package come.tool.JDialog;

import org.cbg.bean.GoodsBackBean;
import org.cbg.frame.TrslationMainJframe;
import org.cbg.panel.TraslationWantSendCardJpanel;
import org.cbg.panel.TraslationWantSentYijishangpinModelJpanel;
import org.come.socket.Agreement;
import org.come.socket.SendMessageUntil;
import org.come.until.GoodsListFromServerUntil;
import org.come.until.GsonUtil;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class CBGFahuoJDialog implements TiShiChuLi{
    @Override
    public void tipBox(boolean tishi, Object object) {
        if (tishi) {

            int packNumber = GoodsListFromServerUntil.Surplussum("-1", "-1", 999);
            TraslationWantSentYijishangpinModelJpanel jpanel2 = (TraslationWantSentYijishangpinModelJpanel) object;

            jpanel2.fahuo.setVisible(false);
            jpanel2.sale_quhui.setVisible(false);

            GoodsBackBean backBean = new GoodsBackBean();
            List<BigDecimal> mesIdList = new ArrayList<>();
            backBean.setBuyerRoleId(jpanel2.salegoods.getBuyerRoleId());
            mesIdList.add(jpanel2.salegoods.getSaleid());
            backBean.setIds(mesIdList);
            backBean.setLeiXing("确认收款");

            String sendmes = Agreement.getAgreement().CBGoodDeliverAgreement(
                    GsonUtil.getGsonUtil().getgson().toJson(backBean));
            SendMessageUntil.toServer(sendmes);

            new Thread(()->{
                try {
                    Thread.sleep(1000L);
                    TraslationWantSendCardJpanel traslationWantSendCardJpanel = TrslationMainJframe.getTrslationMainJframe().getTrslationMainJpanel().getTranslationMainCardJpanel().getTraslationWantSentJpanel().getTraslationWantSendCardJpanel();
                    traslationWantSendCardJpanel.getTraslationWantSentYijishangpinJpanel().MyShow();
                } catch (InterruptedException ex) {
                    ex.printStackTrace();
                }
            }).start();
        }
    }
}
